<template>
	<view>
		<button @click="onSetTimeOut()" type="primary">单次计时器</button>
		<button @click="onSetTimeOut('lwt',666)">启动传参计时器</button>
		<button @click="onClearTimeOut()" type="warn">取消计时器</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name:'zs',
				timerl:null
			}
		},
		methods: {
			onSetTimeOut(){
				console/log("onSetTimeOut()");
			
			//setTimeout(callback,ms,orgs)
		this.timerl=setTimeout(()=>{
				console.log("onSetTimeOut() callback");
				//...
				console.log("onSetTimeOut() callback end");
			},3000);
		},
		onSetTimeOut(username,pwd){
			console.log("onSetTimeOut()",username,pwd);
			setTimeOut((x,y)=>{
				console.log("------callback",x,y);
				
			},2000,username,pwd)
		   },
			   
		   onClearTimeOut(){
			   console.error("onClearTimeOut() 取消计时器");
			   clearTimeout(this.timerl);
		   }
		}
	}
</script>

<style>
button{
	margin:20rpx;
}
</style>
